<template>
  <a-modal v-model="visible" :footer="null" title="阿里云OSS文件存储" width="40%">
    <a-spin :spinning="confirmSpin">
      <a-form-model
        ref="form"
        :model="configData"
        :rules="rules"
        :label-col="labelCol"
        :wrapper-col="wrapperCol">

        <a-form-model-item label="endpoint" prop="ossEndpoint">
          <a-input v-model="configData.ossEndpoint" placeholder="请输入endpoint" :style="disable?{color:'black'}:{}"
                   :disabled="disable"/>
        </a-form-model-item>

        <a-form-model-item label="accessKey" prop="ossAccessKey">
          <a-input v-model="configData.ossAccessKey" placeholder="请输入accessKey" :style="disable?{color:'black'}:{}"
                   :disabled="disable"/>
        </a-form-model-item>

        <a-form-model-item label="secretKey" prop="ossSecretKey">
          <a-input v-model="configData.ossSecretKey" placeholder="请输入secretKey" :style="disable?{color:'black'}:{}"
                   :disabled="disable"/>
        </a-form-model-item>

        <a-form-model-item label="bucketName" prop="ossBucketName">
          <a-input v-model="configData.ossBucketName" placeholder="请输入bucketName" :style="disable?{color:'black'}:{}"
                   :disabled="disable"/>
        </a-form-model-item>

        <a-form-model-item label="staticDomain">
          <a-input v-model="configData.ossStaticDomain" placeholder="请输入staticDomain"
                   :style="disable?{color:'black'}:{}"
                   :disabled="disable"/>
        </a-form-model-item>
        <a-form-model-item :wrapper-col="{ span: 14, offset: 7 }" v-if="!disable">
          <a-button type="primary" style="width:100px;" @click="onSubmit">
            修改
          </a-button>
          <a-button style="margin-left: 20px;width:100px;" @click="resetForm">
            重置
          </a-button>
        </a-form-model-item>

      </a-form-model>
    </a-spin>
  </a-modal>
</template>
<script>
import {getAction, putAction} from "@api/manage";
import {BoneCommonMixin} from "@/mixins/BoneCommonMixin";
import {ConfigDictMixins} from "@views/gospel/configCenter/mixins/ConfigDictMixins";

export default {
  name: "OssUploadModal",
  mixins: [BoneCommonMixin, ConfigDictMixins],
  components: {},
  data() {
    return {
      description: "阿里云OSS文件上传",
      type: "ossConfig",
      rules: {
        ossEndpoint: [
          {required: true, message: '请输入endpoint', trigger: 'blur'},
        ],
        ossAccessKey: [
          {required: true, message: '请输入accessKey', trigger: 'blur'},
        ],
        ossSecretKey: [
          {required: true, message: '请输入secretKey', trigger: 'blur'},
        ],
        ossBucketName: [
          {required: true, message: '请输入bucketName', trigger: 'blur'},
        ],
      },
      url: {configUpdate: "/config/storage/oss",},
      configData: {
        ossEndpoint: "",
        ossAccessKey: "",
        ossSecretKey: "",
        ossBucketName: "",
        ossStaticDomain: ""
      }
    }
  },
}
</script>

<style scoped>

</style>